//A.2 inserted Date type from Chapter 9 with modification by mgm A.2
#ifndef DATE_H_ 
#define DATE_H_

// simple Date
class Date 
{
public:
        //enum Month {
        //      jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
        //};

        //to throw as exceptions
        class Invalid{};

        //Date(int y, Month m, int d);  // check for valid date and initialize

        // check for valid date and initialize (constructor with parameters)
        Date(int y, int m, int d);

        //default constructor
        Date();

        //non-modifying operators (getter)
        int day() const {return d;}
        //Month month() const {return m;}
        int month() const {return m;}
        int year() const {return y;}

        //default date
        Date& default_date();

        //bool is_date(int y, Date::Month m, int d);

        //check validity of date
        bool is_date(int y, int m, int d);      //mgm (A.2)

        //check leap year
        bool leapyear(int y);
        
        //override operator < for comparing two date type by Fransiska Putri Wina (C.1a)
        bool operator< (const Date& a) const{
        		if(this->y != a.y)			return this->y < a.y;
        		else if (this->m != a.m)	return this->m < a.m;
				else if (this->d != a.d)	return this->d < a.d;
        }
        
private:
        int y;  // year
        //Month m;
        int m;  //month
        int d;  // day
};
#endif //DATE_H_
